import type { Directive, DirectiveBinding } from "vue";
// 这是获取的按钮权限
let useRoutesStore = ["1001", "1002", "1003", "1004", "1005", "1006", "1007"];
const permission: Directive = {
  mounted(el: HTMLElement, binding: DirectiveBinding): void {
    const { value } = binding;
    // console.log(binding, 'binding');
    if (!value) return;
    const allBtnMap = useRoutesStore;
    // 可根据自己的业务修改此处实现逻辑
    if (value instanceof Array) {
      if (!value.every((item) => allBtnMap.includes(item))) el.style.display = "none";
      else el.style.display = "auto";
    } else {
      if (!allBtnMap.includes(value)) el.style.display = "none";
      else el.style.display = "auto";
    }

  },
};

export default permission;
